package practice2;

import java.util.Date;

public class BankAccount {
	public static int id=1;
	private int bankAccountId;
	private Date date;
	private double balance;
	BankAccount(Date date,double balance){
		this.bankAccountId = creatBankId();
		this.date = date;
		this.balance = balance;
		BankAccount.id++;
		System.out.println("账户id："+this.bankAccountId+"\n余额"+this.balance);
	}
	public void deposit(double money) {
		balance+=money;
		System.out.println("当前余额:"+balance);
	}
	public void withdraw(double money) {
		if(balance<money) {
			System.out.println("余额不足！");
			return;
		}
		balance-=money;
		System.out.println("当前余额:"+balance);
	}
	private int creatBankId() {
		return id;
	}
}
